package NWish.properties
{
	import NWish.Logger;
	import NWish.properties.custom.*;
	
	import org.aswing.JToggleButton;
	
	
	public class CustomPropertiesTypes
	{
		//private var _parent;
		private var _window;
		
		private var _types:Array;
		public function CustomPropertiesTypes(parent,window)
		{
			//
			//_parent = parent;
			_window = window;
			
			//
			var custom:JToggleButton = new JToggleButton('     custom     ');
			custom.x = 90;
			custom.y = 18;
			custom.pack();
			custom.height = 16;
			window.buttonGroup.append(custom);
			window.panel.append(custom);
			custom.addActionListener(onCustom);
			
			
			//
			_types = [new CustomProperties()
					 ,new CustomPropertiesFile(parent)];
		}
		
		private function onCustom(e)
		{
			if((e.target as JToggleButton).isSelected())
			{
				_window.currPropertiesTypes = this;
				//subMeshs.visible = false;
			}
		}
		
		public function get types()
		{
			return _types;
		}
		
		public function getPropertiesType(obj)
		{
			try
			{
				var e = obj.extra;
				return _types[0];
			}
			catch(e)
			{
				//Logger.log('Can not find the custom properties',obj);
				return null;
			}
		}
		
		public function toString()
		{
			return 'custom properties';
		}
	}
}









